/*
 * Copyright (C) 2015 备胎金服
 * 未经授权允许不得进行拷贝和修改
 *   http://www.btjf.com/
 */
package com.zhangman.framework.implementation;

import android.media.SoundPool;
import com.zhangman.framework.Sound;

/**
 * Created by zhangman on 2016/11/1 11:38.
 * Email: zhangman523@126.com
 */
public class AndroidSound implements Sound {
  int soundId;
  SoundPool mSoundPool;

  public AndroidSound(SoundPool soundPool, int soundId) {
    mSoundPool = soundPool;
    this.soundId = soundId;
  }

  @Override public void play(float volume) {
    mSoundPool.play(soundId, volume, volume, 0, 0, 1);
  }

  @Override public void dispose() {
    mSoundPool.unload(soundId);
  }
}
